home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part1 / 2943 < prev    next >
Encoding:
Text File  |  1996-08-06  |  1.3 KB  |  46 lines

  1. Newsgroups: comp.lang.c++
  2. Path: lugb.latrobe.edu.au!latcs1!charan
  3. From: charan@latcs1.lat.oz.au (Software Access)
  4. Subject: Template Library as DOS *.lib
  5. Message-ID: <DLHpEJ.56p@latcs1.lat.oz.au>
  6. Organization: Comp Sci, La Trobe Uni, Australia
  7. Date: Sat, 20 Jan 1996 17:18:19 GMT
  8.  
  9. Hi C++ Programmer.
  10.     I have made a template which i compile into a static library for
  11.     an exe.
  12.     Using Borland's IDE.We'll i then create and instance of the library
  13.     say PGI<int> *pgi;
  14.     And try and link with the created library.
  15.     Say pgilib.lib,which is supposed to be the library of the template
  16.     PGI!.
  17.     But when i compile it and link,the linker says "PGI<int>() and
  18.     ~PGI<int>() not known.
  19.     Doesn't know about it!.
  20.     Do i have to export the functions within the template ?.
  21.     What do i have to do ?.
  22.     my template goes like this
  23.  
  24.     template <class T> PGI : public Vector {
  25.         public:
  26.             PGI();
  27.             ~PGI();
  28.             // And all the other public functions!.
  29.         };
  30.     Then in another file,
  31.         I go
  32.     PGI<int> *pgi;
  33.     pgi = new PGI<int>;
  34.     pgi->PGI_begin();
  35.  
  36.     Works fine if i run it in the same file as the implementation code.
  37.     But as soon as i put it in another file apart from the source code
  38.     file,the linker no longer knows the constructor,destructor and
  39.     all the rest of the functions!.
  40.  
  41.     Any help will be appreciated!.
  42.  
  43.                 Thanx in Advance.
  44.         email:charan@latcs1.cs.latrobe.edu.au
  45.  
  46.